package org.laobai.shop.goods.service.impl;

import java.util.List;

import org.apache.dubbo.config.annotation.DubboService;
import org.laobai.shop.goods.entity.Spu;
import org.laobai.shop.goods.mapper.SpuMapper;
import org.laobai.shop.goods.service.SpuService;
import org.springframework.beans.factory.annotation.Autowired;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@DubboService
public class SpuServiceImpl implements SpuService{
	
	@Autowired
	private SpuMapper spuMapper;

	@Override
	public PageInfo<Spu> page(int currPage, Spu spu) {
		PageHelper.startPage(currPage, 3);
		List<Spu> tmp = spuMapper.spuList(spu);
		return new PageInfo<>(tmp);
	}

	@Override
	public boolean saveSpu(Spu spu) {
		return spuMapper.saveSpu(spu);
	}

	@Override
	public Spu getById(Integer spuId) {
		return spuMapper.getById(spuId);
	}

	@Override
	public List<Spu> getListByCategoryId(Integer categoryId) {
		return spuMapper.getListByCategoryId(categoryId);
	}


}
